Conversation
… XView/FacebookView into shared components
…ent user on login
…ve, and re-use it for Facebook. Start implementing the Facebook wizard
…cebook, with separate instructions and separate links
redshiftzero
approved these changes
Feb 14, 2025
Contributor
redshiftzero
left a comment
There was a problem hiding this comment.
Ran through the Facebook and X (to check for regressions) flows and all looks good!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Towards #380.
This adds the skeletons of Facebook support, with a FacebookAccountController on the main process with IPC functions hooked up, and a FacebookView and FacebookViewModel on the renderer side.
I've also implements login. It loads
https://www.facebook.com/and then detects if the user is logged in or not by the presence of ac_usercookie set in the browser. If the user is logged in, it then collects all of the<script type="application/json">blocks from the HTML body, parses them all, and then searches them to find the user's Facebook account ID, name, and profile picture URI.Login supports 2FA, including with U2F security keys, though there is a workaround because the "press your security key" thing doesn't pop up, like with X. If you login and 2FA is enabled, it does quickly flash this screen and then immediately move on:
Basically, Cyd detects you're logged in as soon as the
c_usercookie is set, and so at this point the user is already logged in and it moves on from the login state. Do we maybe want to click the "Trust this device" button though? If so, we'd have to figure out how -- like, after the cookie is set, we need to wait for the page to finish loading and detect if we're at this page and if so, click the button. That can be left for a future PR though.I also added very simple support for feature flags. To launch Cyd with Facebook enabled:
export CYD_FEATURE_FACEBOOK=1 npm run startThere's a new IPC function
isFeatureEnabled(feature: string): booleanthat just checks ifCYD_FEATURE_{feature.toUpperCase()}is set to 1 or not. The way I'm using it right now is just in theAccountView.vueview -- it checks for Facebook and Bluesky features, and if the feature flags are set, it displays boxes for selecting those two types of accounts when adding a new account.So if you run Cyd like:
When you add a new account it looks like this:
This all the feature flag does right now. So this means that everything else, including the migration to add the new
facebookAccounttable, and registering all the Facebook IPC functions, etc., is still enabled. If you've already added a Facebook account and then run Cyd again withCYD_FEATURE_FACEBOOK=0, you can use your Facebook account like normal without a problem.Does this seem fine to ship in prod? I think so, but maybe I'm not thinking of something. My idea is once we have a feature (like Facebook) ready enough to enable by default, we just remove the code in
AccountView.vuethat only shows the Facebook option if the Facebook feature is enabled, so instead it always shows.This PR adds the following: